using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_PODETAILMap : EntityTypeConfiguration<SO_PODETAIL>
    {
        public SO_PODETAILMap()
        {
            // Primary Key
            this.HasKey(t => new { t.ID, t.quantity, t.COST, t.SUMFIELDs, t.DImFIELDs });

            // Properties
            this.Property(t => t.ID)
                .IsRequired()
                .HasMaxLength(7);

            this.Property(t => t.ITEM)
                .HasMaxLength(10);

            this.Property(t => t.description)
                .HasMaxLength(250);

            this.Property(t => t.manufacturer_code)
                .HasMaxLength(15);

            this.Property(t => t.currency)
                .HasMaxLength(5);

            this.Property(t => t.UNIT)
                .HasMaxLength(8);

            this.Property(t => t.vendor)
                .HasMaxLength(50);

            this.Property(t => t.SUMFIELDs)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.DImFIELDs)
                .IsRequired()
                .HasMaxLength(27);

            // Table & Column Mappings
            this.ToTable("SO_PODETAIL");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.ITEM).HasColumnName("ITEM");
            this.Property(t => t.description).HasColumnName("description");
            this.Property(t => t.manufacturer_code).HasColumnName("manufacturer_code");
            this.Property(t => t.quantity).HasColumnName("quantity");
            this.Property(t => t.currency).HasColumnName("currency");
            this.Property(t => t.UNIT).HasColumnName("UNIT");
            this.Property(t => t.DATE).HasColumnName("DATE");
            this.Property(t => t.vendor).HasColumnName("vendor");
            this.Property(t => t.SEASON).HasColumnName("SEASON");
            this.Property(t => t.COUNTRY).HasColumnName("COUNTRY");
            this.Property(t => t.Retail_profit_margin).HasColumnName("Retail_profit_margin");
            this.Property(t => t.CLASS).HasColumnName("CLASS");
            this.Property(t => t.COST).HasColumnName("COST");
            this.Property(t => t.TOTAL).HasColumnName("TOTAL");
            this.Property(t => t.SUMFIELDs).HasColumnName("SUMFIELDs");
            this.Property(t => t.DImFIELDs).HasColumnName("DImFIELDs");
        }
    }
}
